/**
 * @author nttdocomo
 */
define(function(require) {
	require("../aries");
	require("./field/field");
	require("./field/checkbox");
	require("./fieldContainer");
	aries.klass("aries.form.CheckboxGroup", aries.form.FieldContainer.extend({
		/**
		 * @cfg {String/Number/Number[]} columns
		 * Specifies the number of columns to use when displaying grouped checkbox/radio controls using automatic layout.
		 * This config can take several types of values:
		 *
		 * - 'auto' - The controls will be rendered one per column on one row and the width of each column will be evenly
		 *   distributed based on the width of the overall field container. This is the default.
		 * - Number - If you specific a number (e.g., 3) that number of columns will be created and the contained controls
		 *   will be automatically distributed based on the value of {@link #vertical}.
		 * - Array - You can also specify an array of column widths, mixing integer (fixed width) and float (percentage
		 *   width) values as needed (e.g., [100, .25, .75]). Any integer values will be rendered first, then any float
		 *   values will be calculated as a percentage of the remaining space. Float values do not have to add up to 1
		 *   (100%) although if you want the controls to take up the entire field container you should do so.
		 */
		columns : 'auto',

		/**
		 * @cfg {Boolean} vertical
		 * True to distribute contained controls across columns, completely filling each column top to bottom before
		 * starting on the next column. The number of controls in each column will be automatically calculated to keep
		 * columns as even as possible. The default value is false, so that controls will be added to columns one at a time,
		 * completely filling each row left to right before starting on the next row.
		 */
		vertical : false,

		/**
		 * @cfg {Boolean} allowBlank
		 * False to validate that at least one item in the group is checked. If no items are selected at
		 * validation time, {@link #blankText} will be used as the error text.
		 */
		allowBlank : true,

		/**
		 * @cfg {String} blankText
		 * Error text to display if the {@link #allowBlank} validation fails
		 */
		//<locale>
		blankText : "You must select at least one item in this group",
		//</locale>

		// private
		//defaultType : 'checkboxfield',
		defaultType : aries.form.field.Checkbox,

		// private
		groupCls : aries.baseCSSPrefix + 'form-check-group',

		/**
		 * @cfg {String} [fieldBodyCls='x-form-checkboxgroup-body']
		 * An extra CSS class to be applied to the body content element in addition to {@link #baseBodyCls}.
		 */
		fieldBodyCls : aries.baseCSSPrefix + 'form-checkboxgroup-body',

		// private
		layout : 'checkboxgroup',

		initComponent : function() {
			var me = this;
			aries.form.FieldContainer.prototype.initComponent.apply(this, arguments);
			me.initField();
		}
	})).mixin({
		field : aries.form.field.Field
	})
})
